package designpattern.observer;

import java.util.Observable;
import java.util.Observer;

public class CurrentConditionDisplay implements Observer{
	Observable observable;
	private float temperature;
	private float humidaty;
	private float pressure;
	
	
	public CurrentConditionDisplay(Observable observable) {
		this.observable = observable;
		observable.addObserver(this);
	}



	@Override
	public void update(Observable o, Object arg) {
		if(o instanceof WeatherData) {
			WeatherData wd = (WeatherData) o;
			this.temperature = wd.getTemperature();
			this.humidaty = wd.getHumidaty();
			this.pressure = wd.getPressure();
			System.out.println("temperature: " + this.temperature);
			System.out.println("humidaty: " + this.humidaty);
			System.out.println("pressure: " + this.pressure);
		}
	}

}
